package com.runjian.rundo.iot.agent.iec104.action.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import com.runjian.rundo.iot.agent.iec104.parser.frame.SIec104Frame;
import org.springframework.stereotype.Component;

import com.runjian.rundo.iot.agent.common.message.DeviceMessage;
import com.runjian.rundo.iot.agent.common.thread.ScheduledExecutorFactory;
import com.runjian.rundo.iot.agent.iec104.action.AbstractActionHandle;
import com.runjian.rundo.iot.agent.iec104.cache.ScheduleTaskCache;
import com.runjian.rundo.iot.agent.iec104.config.Iec104Properties;
import com.runjian.rundo.iot.agent.iec104.consts.Action;
import com.runjian.rundo.iot.agent.iec104.consts.Ti;
import com.runjian.rundo.iot.agent.iec104.manager.Iec104DeviceManager;
import com.runjian.rundo.iot.agent.iec104.module.Iec104Device;
import com.runjian.rundo.iot.agent.iec104.parser.ASDUParser;
import com.runjian.rundo.iot.agent.iec104.parser.frame.IIec104Frame;
import com.runjian.rundo.iot.agent.iec104.session.Iec104TcpClientDeviceSession;

import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 发送S侦
 *
 * @author CaoQingHua
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class SendSFrameActionHandle extends AbstractActionHandle {

    private final ScheduledExecutorFactory taskScheduledExecutorFactory;

    private final Iec104DeviceManager deviceManager;

    private final ASDUParser asduParser;

    private final Iec104Properties iec104Properties;

    private final ScheduleTaskCache scheduleTaskCache;

    @Override
    public Action getAction() {
        return Action.SEND_S_DETECT;
    }

    @Override
    public void handle(DeviceMessage deviceMessage,Iec104TcpClientDeviceSession iec104DeviceSession) {
        SIec104Frame sIec104Frame= new SIec104Frame();
        iec104DeviceSession.writeSAndFlush(sIec104Frame);
    }

}
